<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript">Vue.config.productionTip = false</script>
    <title>姓名案例</title>
</head>
<body>
    <!-- 准备一个容器 -->
    <div id="root">
        <h1>姓:<input type="text" v-model="fristName"></input></h1>
        <h1>名:<input type="text" v-model="lastName"></input></h1>
        <!-- slice是截取 -->
        <h1>全名:<span>{{fullName()}}</span></h1>
    </div>

    <script type="text/javascript">
         new Vue({
            el:"#root",
            data:{
                fristName:"张",
                lastName:"三"
            },
            methods:{
                fullName(){
                    // 这里的this其实就是vm
                    return this.fristName + "-" + this.lastName
                }
            }
         })
    </script>
</body>
</html>